<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>积分申请类型添加页面</title>
  <link rel="stylesheet" href="../../../yl/index.css" />
  <!-- 布局样式 -->
  <link rel="stylesheet" href="../../../yl/style.css" />
  <link rel="stylesheet" href="../../../style/wangeditor.css">
  <link rel="stylesheet" href="../../../yl/mobile.css" />
  <link rel="stylesheet" href="../../../yl/easyui.css" />
  <link rel="stylesheet" href="../../../yl/icon.css" />
  <style>
    .el-tabs__new-tab {
      margin-right: 10px;
    }
  </style>
</head>

<body>
  <!-- <div id="app"> -->
  <div class="easyui-navpanel" id="app" v-cloak>
    <header>
      <div class="m-toolbar">
        <div class="m-title">{{action=='Add'?'添加调查问卷信息':action=='Modify'?'修改调查问卷信息':''}}</div>
      </div>
    </header>
    <div class="easyui-navpanel panel-body panel-body-nobottom panel-body-noborder" style="height: 3000px"
      id="MainTable" ref="MainTable"
      :data-options="JSON.stringify({ 'TableName': 'questionnaire', 'form': 'dataForm' ,'primary_key':'Questionnaire_SerialNumber' })">
      <div class="yl-main">
        <div class="table_titel">
          <div class="titel">调查问卷信息</div>
        </div>
        <el-form :model="dataForm" ref="form" :inline-message="true" style="width: 100%">
          <el-descriptions :column="1" size="large" border>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">标题</div>
              </template>
              <el-form-item :rules="[{ required: true, message: '请输入标题', trigger: 'blur' }]" prop="Questionnaire_Name">
                <el-input v-model="dataForm.Questionnaire_Name" class="borderless-input" placeholder="请输入标题" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">封面</div>
              </template>
              <el-form-item>
                <yl-upload v-model="dataForm.Picture_URL"></yl-upload>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">开始时间</div>
              </template>
              <el-form-item :rules="[{ required: true, message: '请选择开始时间', trigger: 'change' }]" prop="Start_DateTime">
                <el-date-picker v-model="dataForm.Start_DateTime" type="datetime" placeholder="请选择开始时间"
                  class="borderless-input" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
                  size="large" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">结束时间</div>
              </template>
              <el-form-item :rules="[{ required: true, message: '请选择结束时间', trigger: 'change' }]" prop="End_DateTime">
                <el-date-picker v-model="dataForm.End_DateTime" type="datetime" placeholder="请选择结束时间"
                  class="borderless-input" format="YYYY-MM-DD HH:mm:ss" value-format="YYYY-MM-DD HH:mm:ss"
                  size="large" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">介绍</div>
              </template>
              <el-form-item :rules="[{ required: true, message: '请输入介绍', trigger: 'blur' }]" prop="Questionnaire_Notes">
                <el-input type="textarea" :autosize="{ minRows: 4}" v-model="dataForm.Questionnaire_Notes" class="borderless-input" placeholder="请输入介绍" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">参与积分</div>
              </template>
              <el-form-item :rules="[{ required: true, message: '请输入参与积分', trigger: 'blur' }]" prop="Points">
                <el-input type="number" v-model="dataForm.Points" class="borderless-input" placeholder="请输入参与积分" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">范围(默认所有人)</div>
              </template>
              <el-form-item prop="Range">
                <yl-cascader v-model="dataForm.Range" filterable clearable
                  :props="{value:'ProvinceNumber',label:'Province',children:'children'}" placeholder="可选择村行政区范围"
                  :options="city" style="width: 100%"></yl-cascader>
              </el-form-item>
            </el-descriptions-item>
          </el-descriptions>
        </el-form>
        <div class="table_titel">
          <div class="titel">动态表单字段</div>
          <div class="operation">
            <el-button type="primary" size="small" @click="handleColumnAdd">新增</el-button>
            <el-button type="danger" size="small" @click="handleColumnRemove">删除</el-button>
          </div>
        </div>
        <el-form :model="{tableData}" ref="form1" :inline-message="true" style="width: 100%">
          <el-descriptions :column="3" size="large" border v-for="(item,index) in tableData" :key="index">
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">{{index+1}}.字段名称</div>
              </template>
              <el-form-item :rules="[{ required: true, message: '请输入字段名称', trigger: 'blur' }]"
                :prop="'tableData.' + index + '.COLUMN_COMMENT'">
                <el-input type="textarea"
                :autosize="{ minRows:  4}"  v-model="item.COLUMN_COMMENT" class="borderless-input" placeholder="请输入字段名称" />
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">标签类型</div>
              </template>
              <el-form-item :rules="[{ required: true, message: '请选择标签类型', trigger: 'change' }]"
                :prop="'tableData.' + index + '.LABEL_TYPE'">
                <el-select clearable v-model.trim="item.LABEL_TYPE" placeholder="请选择标签类型" filterable
                  style="width: 100%">
                  <el-option v-for="(item,index) in label" :key="index" :label="item.label"
                    :value="item.value"></el-option>
                </el-select>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item>
              <template #label>
                <div class="cell-item">是否必填</div>
              </template>
              <el-form-item :rules="[{ required: true, message: '请输入字段名称', trigger: 'blur' }]"
                :prop="'tableData.' + index + '.COLUMN_COMMENT'">
                <el-switch v-model="item.REQUIRED" active-text="是" inactive-text="否" active-value="1"
                  inactive-value="0"></el-switch>
              </el-form-item>
            </el-descriptions-item>
            <el-descriptions-item
              v-if="item.LABEL_TYPE == 'select' || item.LABEL_TYPE == 'radio' || item.LABEL_TYPE == 'checkbox'">
              <template #label>
                <div class="cell-item">可选数据源</div>
              </template>
              <div style="margin-top: 10px;">
                <el-button type="primary" icon="CirclePlus"  plain
                  style="margin:0 10px 10px 0;" @click="handleData(item)">添加</el-button>
                <el-input v-for="(obj,index) in item.DATA" :key="index" v-model="obj.label" placeholder="请输入可选数据"
                  style="width: 250px; margin:0 10px 10px 0;">
                  <template #suffix>
                    <el-icon style="cursor: pointer;" @click="RemoveData(item,index)"><Circle-Close /></el-icon>
                  </template>
                </el-input>
              </div>
            </el-descriptions-item>
          </el-descriptions>
        </el-form>
      </div>
    </div>
    <footer class="botton-ann">
      <el-button @click="goBack">返回</el-button>
      <el-button type="primary" :loading="loading" plain @click="handleSubmit">提交</el-button>
    </footer>
  </div>
</body>
<script src="../../../utils/utils.js"></script>
<script src="../../../config/config.js"></script>
<script src="../../../utils/compressor.js"></script>
<script src="../../../utils/wangeditor.js"></script>
<script src="../../../utils/mixins.js"></script>
<script src="../../../yl/vue.js"></script>
<script src="../../../yl/index.js"></script>
<script src="../../../yl/zh-cn.mjs"></script>
<script src="../../../yl/index.iife.min.js"></script>
<script src="../../../yl/jquery.min.js"></script>
<script src="../../../utils/jquery.cookie.js"></script>
<script src="../../../yl/jquery.easyui.min.js"></script>
<script src="../../../yl/jquery.easyui.mobile.js"></script>
<script src="../../../yl/moment.min.js"></script>
<script src="../../../api/request.js"></script>
<script src="./js/add.js"></script>

</html>